package com.wwdeng.smart.video

import android.annotation.SuppressLint
import android.view.View
import com.wwdeng.smart.R
import com.wwdeng.smart.base.BaseFm
import com.wwdeng.smart.databinding.IncludeVideoRealTimeBinding
import com.wwdeng.smart.video.customview.ImageTouchView


/**
 * android
 * @Author：wwdeng
 * @CreateTime：2024/9/16 17:35
 * <pre>
 * 实时视频操作
 * </pre>
 */
class RealTimeFragment(): BaseFm(), ImageTouchView.ImageTouchListener {
    lateinit var binding: IncludeVideoRealTimeBinding
    var videoAct: VideoPreviewAct? = null

    constructor(videoAct: VideoPreviewAct): this(){
        this.videoAct = videoAct
    }

    override fun getRootView(): View {
        binding = IncludeVideoRealTimeBinding.inflate(layoutInflater)
        return binding.root
    }

    override fun initView() {
        binding.imgOrientation.setImageResource(R.mipmap.pic_camera_default)
        binding.imgTouch.setImageResource(R.mipmap.pic_camera_reset)
    }

    @SuppressLint("ClickableViewAccessibility")
    override fun initListener() {
        binding.imgTouch.setTouchListener(this)
    }

    override fun initData() {
    }

    override fun onSwipeRight() {
        // 右滑
        binding.imgOrientation.setImageResource(R.mipmap.pic_camera_right)
    }

    override fun onSwipeLeft() {
        // 左滑
        binding.imgOrientation.setImageResource(R.mipmap.pic_camera_left)
    }

    override fun onSwipeTop() {
        // 上滑
        binding.imgOrientation.setImageResource(R.mipmap.pic_camera_up)
    }

    override fun onSwipeBottom() {
        // 下滑
        binding.imgOrientation.setImageResource(R.mipmap.pic_camera_down)
    }

    override fun onSwipeTouchUp() {
        //复位
        binding.imgOrientation.setImageResource(R.mipmap.pic_camera_default)
    }

}